package SHIYAN;

import java.util.Arrays;
public class SHIYAN22 {
    public static void main(String[] args) {
        int [] arr = {1,1,2,2,3,3,4,4,5,5};
        int [] arr1 = new int [5];
        int k = 0;
        int j = 0;
        for(int i = 0; i <= arr.length;i++)
        {
            for( j =i+1 ; j<arr.length;j++) {
                if (arr[i] != arr[j]) {
                    arr1[k] = arr[i];
                    k+=1;
                    break;
                }
                else
                    break;
            }
            if (j == arr.length)
                arr1[k] = arr[arr.length-1];
        }
        System.out.println(Arrays.toString(arr1));
    }
}
